
package DTO;

/**
 * This class acts as data transfer abstraction for order object attributes. It encapsulates address attributes.
 * This object is transferred back and forth amongst various layers.
 * @author tejinder
 * @see DTO
 */
import java.util.*;

public class Order {

    private int id; // 0 if the order is not in the DB
    private String orderDate; // "" for unsubmit order
    private double itemSubTotal; // supply by other sys
    private double taxAmount; // supply by other sys
    private String orderStatus; // "" if the order is not in the DB
    private double shippingFee; // 0.00 if store order
    private double totalItemDiscount; // supply by other sys
    private double orderDiscount; // supply by other sys
    private double storeCardDiscountTotal; // supply by other sys
    private double grandTotal;
    private String storeName; // supply by other sys
    private int shid; // 0 for store order
    private int csid; // 0 for store order
    private int aid; // 0 for store order
    private List<Item> itemList;
    private List<Payment> paymentList;

    public Order() {
    }

    /**
     * Constructor for View order passing
     * @param id
     * @param orderDate
     * @param itemSubTotal
     * @param taxAmount
     * @param orderStatus
     * @param shippingFee
     * @param totalItemDiscount
     * @param orderDiscount
     * @param storeCardDiscountTotal
     * @param storeName
     * @param shid
     * @param csid
     * @param aid
     * @param itemList
     * @param paymentList 
     */
    public Order(int id,
            String orderDate,
            double itemSubTotal,
            double taxAmount,
            String orderStatus,
            double shippingFee,
            double totalItemDiscount,
            double orderDiscount,
            double storeCardDiscountTotal,
            String storeName,
            int shid, int csid, int aid) {
        this.id = id;
        this.orderDate = orderDate;

        this.itemSubTotal = itemSubTotal;
        this.taxAmount = taxAmount;
        this.orderStatus = orderStatus;
        this.shippingFee = shippingFee;

        this.totalItemDiscount = totalItemDiscount;
        this.orderDiscount = orderDiscount;
        this.storeCardDiscountTotal = storeCardDiscountTotal;

        this.storeName = storeName;
        this.shid = shid;
        this.csid = csid;
        this.aid = aid;
    }

    /**
     * Constructor for desktop order passing
     * @param itemSubTotal
     * @param taxAmount
     * @param shippingFee
     * @param totalItemDiscount
     * @param orderDiscount
     * @param storeCardDiscountTotal
     * @param storeName
     * @param shid
     * @param csid
     * @param aid
     * @param itemList
     * @param paymentList
     */
    public Order(String orderDate,
            double itemSubTotal,
            double taxAmount,
            double shippingFee,
            double totalItemDiscount,
            double orderDiscount,
            double storeCardDiscountTotal,
            String storeName,
            int shid, int csid, int aid,
            ArrayList<Item> itemList,
            ArrayList<Payment> paymentList) {

        this.orderDate = orderDate;

        this.itemSubTotal = itemSubTotal;
        this.taxAmount = taxAmount;
        this.shippingFee = shippingFee;

        this.totalItemDiscount = totalItemDiscount;
        this.orderDiscount = orderDiscount;
        this.storeCardDiscountTotal = storeCardDiscountTotal;

        this.storeName = storeName;
        this.shid = shid;
        this.csid = csid;
        this.aid = aid;

        this.itemList = (ArrayList<Item>) itemList.clone();
        this.paymentList = (ArrayList<Payment>) paymentList.clone();
    }

    /**
     * Constructor for store order passing
     * @param itemSubTotal
     * @param taxAmount
     * @param totalItemDiscount
     * @param orderDiscount
     * @param storeCardDiscountTotal
     * @param storeName
     * @param itemList
     * @param paymentList 
     */
    public Order(double itemSubTotal,
            double taxAmount,
            double totalItemDiscount,
            double orderDiscount,
            double storeCardDiscountTotal,
            String storeName,
            String orderDate,
            ArrayList<Item> itemList,
            ArrayList<Payment> paymentList) {
        this.orderDate = orderDate;

        this.itemSubTotal = itemSubTotal;
        this.taxAmount = taxAmount;

        this.totalItemDiscount = totalItemDiscount;
        this.orderDiscount = orderDiscount;
        this.storeCardDiscountTotal = storeCardDiscountTotal;

        this.storeName = storeName;

        this.itemList = itemList;
        this.paymentList = paymentList;
        shippingFee = 0.0;
        id = 0;
        orderStatus = "";
        shid = 0;
        csid = 0;
        aid = 0;
    }


    /**
     * gets order id 
     * @return
     */

    public double getGrandTotal() {
        return grandTotal;
    }

    /**
     *
     * @param grandTotal
     */
    public void setGrandTotal(double grandTotal) {
        this.grandTotal = grandTotal;
    }

    /**
     * 
     * @return
     */

    public int getID() {
        return getId();
    }

    /**
     * sets order id 
     * @param id
     */
    public void setID(int id) {
        this.setId(id);
    }

    /**
     * gets order date 
     * @return order date string 
     */
    public String getOrderDate() {
        return orderDate;
    }

    /**
     * gets item subtotal
     * @return double 
     */
    public double getItemSubTotal() {
        return itemSubTotal;
    }

    /**
     * gets tax amount
     * @return double
     */
    public double getTaxAmount() {
        return taxAmount;
    }

    /**
     * gets status of an order
     * @return string 
     */
    public String getOrderStatus() {
        return orderStatus;
    }

    /**
     * gets shipping fee
     * @return double 
     */
    public double getShippingFee() {
        return shippingFee;
    }

    /**
     * gets total item discount
     * @return double
     */
    public double getTotalItemDiscount() {
        return totalItemDiscount;
    }

    /**
     * gets order discount
     * @return double
     */
    public double getOrderDiscount() {
        return orderDiscount;
    }

    /**
     * gets store card discount total
     * @return double
     */
    public double getStoreCardDiscountTotal() {
        return storeCardDiscountTotal;
    }

    /**
     *gets name of store
     * @return string
     */
    public String getStoreName() {
        return storeName;
    }

    /**
     * gets shipping id
     * @return integer id
     */
    public int getShID() {
        return getShid();
    }

    /**
     * gets store card number
     * @return integer
     */
    public int getStoreCardNumber() {
        return getCsid();
    }

    /**
     * gets address id
     * @return integer
     */
    public int getAddressID() {
        return getAid();
    }

    /**
     * gets item list
     * @return list
     */
    public List<Item> getItemList() {
        return itemList;
    }

    /**
     *gets payment list
     * @return list
     */
    public List<Payment> getPaymentList() {
        return paymentList;
    }

    /**
     * gets order id
     * @return integer id
     */
    public int getId() {
        return id;
    }

    /**
     * sets id
     * @param id the id to set
     */
    public void setId(int id) {
        this.id = id;
    }

    /**
     * sets order date 
     * @param orderDate the orderDate to set
     */
    public void setOrderDate(String orderDate) {
        this.orderDate = orderDate;
    }

    /**
     * sets item sub total
     * @param itemSubTotal the itemSubTotal to set
     */
    public void setItemSubTotal(double itemSubTotal) {
        this.itemSubTotal = itemSubTotal;
    }

    /**
     * sets tax amount 
     * @param taxAmount the taxAmount to set
     */
    public void setTaxAmount(double taxAmount) {
        this.taxAmount = taxAmount;
    }

    /**
     * sets order status 
     * @param orderStatus the orderStatus to set
     */
    public void setOrderStatus(String orderStatus) {
        this.orderStatus = orderStatus;
    }

    /**
     * sets shipping fee
     * @param shippingFee the shippingFee to set
     */
    public void setShippingFee(double shippingFee) {
        this.shippingFee = shippingFee;
    }

    /**
     * sets total discount on item
     * @param totalItemDiscount the totalItemDiscount to set
     */
    public void setTotalItemDiscount(double totalItemDiscount) {
        this.totalItemDiscount = totalItemDiscount;
    }

    /**
     * sets total discount on order
     * @param orderDiscount the orderDiscount to set
     */
    public void setOrderDiscount(double orderDiscount) {
        this.orderDiscount = orderDiscount;
    }

    /**
     * sets store card discount
     * @param storeCardDiscountTotal the storeCardDiscountTotal to set
     */
    public void setStoreCardDiscountTotal(double storeCardDiscountTotal) {
        this.storeCardDiscountTotal = storeCardDiscountTotal;
    }

    /**
     * sets the name of store
     * @param storeName the storeName to set
     */
    public void setStoreName(String storeName) {
        this.storeName = storeName;
    }

    /**
     * gets shipping id
     * @return the id
     */
    public int getShid() {
        return shid;
    }

    /**
     * sets shipping id
     * @param shid 
     */
    public void setShid(int shid) {
        this.shid = shid;
    }

    /**
     * gets customer id
     * @return integer
     */
    public int getCsid() {
        return csid;
    }

    /**
     * sets customer id
     * @param csid the  to set
     */
    public void setCsid(int csid) {
        this.csid = csid;
    }

    /**
     * gets address id
     * @return the aid
     */
    public int getAid() {
        return aid;
    }

    /**
     * sets address id 
     * @param aid the aid to set
     */
    public void setAid(int aid) {
        this.aid = aid;
    }

    /**
     * sets list of items
     * @param itemList the itemList to set
     */
    public void setItemList(List<Item> itemList) {
        this.itemList = itemList;
    }

    /**
     * sets payment list 
     * @param paymentList the paymentList to set
     */
    public void setPaymentList(List<Payment> paymentList) {
        this.paymentList = paymentList;
    }

   
}
